<template>
	<view>
		<view class="example">
			<uni-forms ref="valiForm" :modelValue="valiFormData">
				<uni-forms-item label="用车部门" name="userDepartment">
					<uni-easyinput v-model="valiFormData.userDepartment" placeholder="请输入用车部门" disabled=""></uni-easyinput>
				</uni-forms-item>
				<uni-forms-item label="姓名" name="userName">
					<uni-easyinput v-model="valiFormData.userName" placeholder="请输入姓名" disabled />
				</uni-forms-item>
				<uni-forms-item label="工号" name="userId">
					<uni-easyinput v-model="valiFormData.userId" placeholder="请输入工号" disabled />
				</uni-forms-item>
				<uni-forms-item label="申请人电话" name="userPhone">
					<uni-easyinput v-model="valiFormData.userPhone" placeholder="请输入电话" disabled />
				</uni-forms-item>
				<uni-forms-item label="车型" name="autoType">
					<uni-easyinput v-model="valiFormData.autoType" placeholder="请输入车型" disabled=""></uni-easyinput>
				</uni-forms-item>
				<uni-forms-item label="成员数" name="passengerNum">
					<uni-easyinput v-model="valiFormData.passengerNum" placeholder="请输入成员数" disabled />
				</uni-forms-item>
				<uni-forms-item label="取车时间" name="autoStartTime">
					<uni-datetime-picker type="datetime" return-type="string" v-model="valiFormData.autoStartTime" disabled />
				</uni-forms-item>
				<uni-forms-item label="截止时间" name="autoArriveTime">
					<uni-datetime-picker type="datetime" return-type="string" v-model="valiFormData.autoArriveTime" disabled />
				</uni-forms-item>
				<uni-forms-item label="用车事宜" name="autoUseReason">
					<uni-easyinput type="textarea" v-model="valiFormData.autoUseReason" placeholder="请输入用车事宜" disabled />
				</uni-forms-item>
				<uni-forms-item label="目前状态">
					<uni-easyinput v-model="valiFormData.autoOrderStatus" placeholder="请输入当前状态" disabled />
				</uni-forms-item>
			</uni-forms>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				valiFormData: {
					userDepartment: "",
					userName: "",
					userId: "",
					userPhone: "",
					autoType: "",
					passengerNum: "",
					autoStartTime: "",
					autoArriveTime: "",
					autoUseReason: "",
					autoOrderStatus: ""
				},
				orderId:'',
			}
		},
		methods: {
			getAutoApplicationDetail(){
				uni.request({
					url:"http://localhost:8088/getAutoOrderDetail?autoOrderId="+this.orderId,
					method:"GET",
					success:(res)=> {
						if(res.data.code === "0"){
							console.log(res.data.data);
							this.valiFormData = res.data.data;
						}
						
					}
				})
			}
		},
		created() {
			const orderId = this.$route.query.orderId || ""; // 如果没有 orderId 参数，默认设置为空字符串
			this.orderId = orderId;
			console.log(this.orderId);
			this.getAutoApplicationDetail();
		}
	}
</script>

<style lang="scss">
	.example {
		padding: 15px;
		background-color: #fff;
	}

	.segmented-control {
		margin-bottom: 15px;
	}

	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		margin-left: 10px;
	}
</style>